Declare Function GetSystemMetrics Lib "User" (ByVal nIndex As Integer) As Integer
Declare Function GetWindow Lib "User" (ByVal hWnd As Integer, ByVal wCmd As Integer) As Integer
Declare Sub GetClientRect Lib "User" (ByVal hWnd As Integer, lpRect As Rect)
Declare Sub InflateRect Lib "User" (lpRect As Rect, ByVal X As Integer, ByVal Y As Integer)
Declare Function SendMessage Lib "User" (ByVal hWnd As Integer, ByVal wMsg As Integer, ByVal wParam As Integer, lParam As Any) As Long
Declare Function ShowWindow Lib "User" (ByVal hWnd As Integer, ByVal nCmdShow As Integer) As Integer
Declare Function IsWindowVisible Lib "User" (ByVal hWnd As Integer) As Integer
Declare Function BitBlt Lib "GDI" (ByVal hDestDC As Integer, ByVal X As Integer, ByVal Y As Integer, ByVal nWidth As Integer, ByVal nHeight As Integer, ByVal hSrcDC As Integer, ByVal XSrc As Integer, ByVal YSrc As Integer, ByVal dwRop As Long) As Integer
Declare Function SetParent Lib "User" (ByVal hWndChild As Integer, ByVal hWndNewParent As Integer) As Integer
Declare Function GetDC Lib "User" (ByVal hWnd As Integer) As Integer
Declare Function ReleaseDC Lib "User" (ByVal hWnd As Integer, ByVal hDC As Integer) As Integer
Declare Function SelectObject Lib "GDI" (ByVal hDC As Integer, ByVal hObject As Integer) As Integer
Declare Function DeleteObject Lib "GDI" (ByVal hObject As Integer) As Integer
Declare Function CreateSolidBrush Lib "GDI" (ByVal crColor As Long) As Integer
Declare Function CreatePen Lib "GDI" (ByVal nPenStyle As Integer, ByVal nWidth As Integer, ByVal crColor As Long) As Integer
Declare Function CreateEllipticRgn Lib "GDI" (ByVal X1 As Integer, ByVal Y1 As Integer, ByVal X2 As Integer, ByVal Y2 As Integer) As Integer
Declare Function Rectangle Lib "GDI" (ByVal hDC As Integer, ByVal X1 As Integer, ByVal Y1 As Integer, ByVal X2 As Integer, ByVal Y2 As Integer) As Integer
Declare Function FillRect Lib "User" (ByVal hDC As Integer, lpRect As Rect, ByVal hBrush As Integer) As Integer
Declare Function FillRgn Lib "GDI" (ByVal hDC As Integer, ByVal hRgn As Integer, ByVal hBrush As Integer) As Integer
Declare Function TextOut Lib "GDI" (ByVal hDC As Integer, ByVal X As Integer, ByVal Y As Integer, ByVal lpString As String, ByVal nCount As Integer) As Integer
Declare Function SetBkColor Lib "GDI" (ByVal hDC As Integer, ByVal crColor As Long) As Long
Declare Function GetBkColor Lib "GDI" (ByVal hDC As Integer) As Long
Declare Function SetBkMode Lib "GDI" (ByVal hDC As Integer, ByVal nBkMode As Integer) As Integer
Declare Function GetBkMode Lib "GDI" (ByVal hDC As Integer) As Integer
Declare Function SetTextColor Lib "GDI" (ByVal hDC As Integer, ByVal crColor As Long) As Long
Declare Function GetTextColor Lib "GDI" (ByVal hDC As Integer) As Long
' Some Windows messages watchable by MsgBlast
Global Const WM_CHILDACTIVATE = &H22
Global Const WM_ERASEBKGND = &H14
Global Const WM_HSCROLL = &H114
Global Const WM_MDIACTIVATE = &H222
Global Const WM_MDICASCADE = &H227
Global Const WM_MDICREATE = &H220
Global Const WM_MDIDESTROY = &H221
Global Const WM_MDIGETACTIVE = &H229
Global Const WM_MDIICONARRANGE = &H228
Global Const WM_MDIMAXIMIZE = &H225
Global Const WM_MDINEXT = &H224
Global Const WM_MDIRESTORE = &H223
Global Const WM_MDISETMENU = &H230
Global Const WM_MDITILE = &H226
Global Const WM_PAINT = &HF
Global Const WM_SETREDRAW = &HB
Global Const WM_VSCROLL = &H115
' MsgBlast processing options
Global Const MB_PREPROCESS = -1
Global Const MB_EATMESSAGE = 0
Global Const MB_POSTPROCESS = 1
' ShowWindow() Commands
Global Const WM_SHOWWINDOW = &H18
Global Const SW_HIDE = 0
Global Const SW_SHOWNORMAL = 1
Global Const SW_NORMAL = 1
Global Const SW_SHOWMINIMIZED = 2
Global Const SW_SHOWMAXIMIZED = 3
Global Const SW_MAXIMIZE = 3
Global Const SW_SHOWNOACTIVATE = 4
Global Const SW_SHOW = 5
Global Const SW_MINIMIZE = 6
Global Const SW_SHOWMINNOACTIVE = 7
Global Const SW_SHOWNA = 8
Global Const SW_RESTORE = 9
' MDI messages (previously defined)
'Global Const WM_MDITILE = &H226
'Global Const WM_MDICASCADE = &H227
'Global Const WM_MDIICONARRANGE = &H228
' wParam values for WM_MDITILE and WM_MDICASCADE messages.
Global Const MDITILE_VERTICAL = &H0
Global Const MDITILE_HORIZONTAL = &H1
Global Const MDITILE_SKIPDISABLED = &H2 'Requires Win 3.1
' GetWindow() Constants
Global Const GW_HWNDFIRST = 0
Global Const GW_HWNDLAST = 1
Global Const GW_HWNDNEXT = 2
Global Const GW_HWNDPREV = 3
Global Const GW_OWNER = 4
Global Const GW_CHILD = 5
' WindowState
Global Const NORMAL = 0 ' 0 - Normal
Global Const MINIMIZED = 1 ' 1 - Minimized
Global Const MAXIMIZED = 2 ' 2 - Maximized
' System Color(s)
Global Const APPLICATION_WORKSPACE = &H8000000C ' Background color of multiple document interface (MDI) applications.
' Raster-ops (Ternary)
Global Const SRCCOPY = &HCC0020 ' (DWORD) dest = source
Global Const SRCPAINT = &HEE0086 ' (DWORD) dest = source OR dest
Global Const SRCAND = &H8800C6 ' (DWORD) dest = source AND dest
Global Const SRCINVERT = &H660046 ' (DWORD) dest = source XOR dest
Global Const SRCERASE = &H440328 ' (DWORD) dest = source AND (NOT dest )
Global Const NOTSRCCOPY = &H330008 ' (DWORD) dest = (NOT source)
Global Const NOTSRCERASE = &H1100A6 ' (DWORD) dest = (NOT src) AND (NOT dest)
Global Const MERGECOPY = &HC000CA ' (DWORD) dest = (source AND pattern)
Global Const MERGEPAINT = &HBB0226 ' (DWORD) dest = (NOT source) OR dest
Global Const PATCOPY = &HF00021 ' (DWORD) dest = pattern
Global Const PATPAINT = &HFB0A09 ' (DWORD) dest = DPSnoo
Global Const PATINVERT = &H5A0049 ' (DWORD) dest = pattern XOR dest
Global Const DSTINVERT = &H550009 ' (DWORD) dest = (NOT dest)
Global Const BLACKNESS = &H42& ' (DWORD) dest = BLACK
Global Const WHITENESS = &HFF0062 ' (DWORD) dest = WHITE
' StretchBlt() Modes
Global Const BLACKONWHITE = 1
Global Const WHITEONBLACK = 2
Global Const COLORONCOLOR = 3
' Pen Styles
Global Const PS_SOLID = 0
Global Const PS_DASH = 1 ' -------
Global Const PS_DOT = 2 ' .......
Global Const PS_DASHDOT = 3 ' _._._._
Global Const PS_DASHDOTDOT = 4 ' _.._.._
Global Const PS_NULL = 5
Global Const PS_INSIDEFRAME = 6
' ScaleMode
Global Const USER = 0 ' 0 - User
Global Const TWIPS = 1 ' 1 - Twip
Global Const POINTS = 2 ' 2 - Point
Global Const PIXELS = 3 ' 3 - Pixel
Global Const CHARACTERS = 4 ' 4 - Character
Global Const INCHES = 5 ' 5 - Inch
Global Const MILLIMETERS = 6 ' 6 - Millimeter
Global Const CENTIMETERS = 7 ' 7 - Centimeter
' GetSystemMetrics() codes
Global Const SM_CXSCREEN = 0
Global Const SM_CYSCREEN = 1
Global Const SM_CXVSCROLL = 2
Global Const SM_CYHSCROLL = 3
Global Const SM_CYCAPTION = 4
Global Const SM_CXBORDER = 5
Global Const SM_CYBORDER = 6
Global Const SM_CXDLGFRAME = 7
Global Const SM_CYDLGFRAME = 8
Global Const SM_CYVTHUMB = 9
Global Const SM_CXHTHUMB = 10
Global Const SM_CXICON = 11
Global Const SM_CYICON = 12
Global Const SM_CXCURSOR = 13
Global Const SM_CYCURSOR = 14
Global Const SM_CYMENU = 15
Global Const SM_CXFULLSCREEN = 16
Global Const SM_CYFULLSCREEN = 17
Global Const SM_CYKANJIWINDOW = 18
Global Const SM_MOUSEPRESENT = 19
Global Const SM_CYVSCROLL = 20
Global Const SM_CXHSCROLL = 21
Global Const SM_DEBUG = 22
Global Const SM_SWAPBUTTON = 23
Global Const SM_RESERVED1 = 24
Global Const SM_RESERVED2 = 25
Global Const SM_RESERVED3 = 26
Global Const SM_RESERVED4 = 27
Global Const SM_CXMIN = 28
Global Const SM_CYMIN = 29
Global Const SM_CXSIZE = 30
Global Const SM_CYSIZE = 31
Global Const SM_CXFRAME = 32
Global Const SM_CYFRAME = 33
Global Const SM_CXMINTRACK = 34
Global Const SM_CYMINTRACK = 35
Global Const SM_CMETRICS = 36
Sub DisplayStatus (StatTxt$)
'Update status bar on main form
If frmMain!pStatus <> StatTxt$ Then
frmMain!pStatus = StatTxt$
End If
End Sub
Sub mdiArrange (method%)
'Use the MDI Arrange methods rather than VB's because it can
'ignore disabled (hidden) children.
Dim Ret%
Select Case method
Case WM_MDICASCADE
Ret = SendMessage(GetWindow(frmMain.hWnd, GW_CHILD), WM_MDICASCADE, MDITILE_SKIPDISABLED, 0&)
Case MDITILE_HORIZONTAL
Ret = SendMessage(GetWindow(frmMain.hWnd, GW_CHILD), WM_MDITILE, MDITILE_HORIZONTAL Or MDITILE_SKIPDISABLED, 0&)
Case MDITILE_VERTICAL
Ret = SendMessage(GetWindow(frmMain.hWnd, GW_CHILD), WM_MDITILE, MDITILE_VERTICAL Or MDITILE_SKIPDISABLED, 0&)
Case WM_MDIICONARRANGE
Ret = SendMessage(GetWindow(frmMain.hWnd, GW_CHILD), WM_MDIICONARRANGE, MDITILE_SKIPDISABLED, 0&)
End Select
End Sub
Sub mdiBitBltCentered (sWnd%, sDC%, dWnd%)
'Initialize some variables
Dim nRet%, cDC%, cWnd%, dX%, dY%
Dim sR As Rect, dR As Rect
'get DC to client space (assumes we're Blt'ing onto an MDI client space)